# encoding=utf-8
from flask import Blueprint

from app.Bean.ResultData import ResultData
from app.Models.Players import Players
from app.Service.PlayerService import PlayerService
from app.Vendor.Utils import Utils
from flask import request

player = Blueprint('player', __name__)
player_service = PlayerService()


@player.route('/player/player_list', methods=['GET'])
def player_list():
    return ResultData().sucess(player_service.get_player_list())


@player.route('/player/history_agg', methods=['GET'])
def history_agg():
    player_name = request.args.get('player_name')
    return ResultData().sucess(player_service.get_history_agg(player_name))


@player.route('/player/history', methods=['GET'])
def history():
    player_name = request.args.get('player_name')
    return ResultData().sucess(player_service.get_history_data(player_name))


@player.route('/player/season', methods=['GET'])
def season():
    player_name = request.args.get('player_name')
    season_name = request.args.get('season_name')
    return ResultData().sucess(player_service.get_season_data(player_name, season_name))
